var e = require("../../../../component/WxNotificationCenter/WxNotificationCenter.js"), t = getApp();

Page({
    data: {
        permission: {},
        phoneText: "",
        teamText: "",
        scheduleText: "",
        priceText: ""
    },
    loadData: function() {
        var e = this;
        t.network.post({
            url: t.url.getPermission,
            params: {},
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(a) {
                1 == a.data.result ? (e.setData({
                    permission: a.data.data.permission
                }), e.handlePermisionResult()) : t.util.showToast(a.data.message);
            },
            fail: function() {
                t.util.showToast("获取设置失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading();
            }
        });
    },
    bindTapItem: function(e) {
        var t = e.currentTarget.dataset.title, a = JSON.stringify(this.data.permission);
        wx.navigateTo({
            url: "eidtPrivacye/eidtPrivacye?title=" + t + "&permission=" + a
        });
    },
    handlePermisionResult: function() {
        var e, t = this.data.permission, a = parseInt(t.phoneAll), n = parseInt(t.phoneAttention), o = parseInt(t.phoneTeam), i = parseInt(t.phonePlanner), c = parseInt(t.phoneMe), s = parseInt(t.phoneBlack), r = parseInt(t.phoneWhite), l = parseInt(t.priceAll), p = parseInt(t.priceAttention), h = parseInt(t.priceTeam), u = parseInt(t.pricePlanner), d = parseInt(t.priceMe), m = parseInt(t.priceBlack), f = parseInt(t.priceWhite), I = parseInt(t.scheduleAll), g = parseInt(t.scheduleAttention), T = parseInt(t.scheduleTeam), S = parseInt(t.schedulePlanner), v = parseInt(t.scheduleMe), P = parseInt(t.scheduleBlack), x = parseInt(t.scheduleWhite), A = parseInt(t.teamHomeScheduleAll), w = parseInt(t.teamHomeScheduleAttention), D = parseInt(t.teamHomeScheduleBlack), H = parseInt(t.teamHomeScheduleMe), B = parseInt(t.teamHomeSchedulePlanner), N = parseInt(t.teamHomeScheduleTeam), y = parseInt(t.teamHomeScheduleWhite);
        if (1 == a) e = "向所有人公开"; else if (1 == c) e = "向所有人隐藏"; else {
            b = [];
            1 == n && (b = b.concat("向我关注的人公开")), 1 == o && (b = b.concat("团队成员可见")), 1 == i && (b = b.concat("向策划师公开")), 
            1 == r && (b = b.concat("向白名单用户公开")), 1 == s && (b = b.concat("向黑名单用户隐藏")), e = b.toString();
        }
        var W;
        if (1 == I) W = "向所有人公开"; else if (1 == v) W = "向所有人隐藏"; else {
            b = [];
            1 == g && (b = b.concat("向我关注的人公开")), 1 == T && (b = b.concat("团队成员可见")), 1 == S && (b = b.concat("向策划师公开")), 
            1 == x && (b = b.concat("向白名单用户公开")), 1 == P && (b = b.concat("向黑名单用户隐藏")), W = b.toString();
        }
        if (1 == l) "向所有人公开"; else if (1 == d) "向所有人隐藏"; else {
            var b = [];
            1 == p && (b = b.concat("向我关注的人公开")), 1 == h && (b = b.concat("团队成员可见")), 1 == u && (b = b.concat("向策划师公开")), 
            1 == f && (b = b.concat("向白名单用户公开")), 1 == m && (b = b.concat("向黑名单用户隐藏")), b.toString();
        }
        var k;
        1 == A ? k = "向所有人公开" : 1 == H ? k = "向所有人隐藏" : (b = [], 1 == w && (b = b.concat("向我关注的人公开")), 
        1 == N && (b = b.concat("团队成员可见")), 1 == B && (b = b.concat("向策划师公开")), 1 == y && (b = b.concat("向白名单用户公开")), 
        1 == D && (b = b.concat("向黑名单用户隐藏")), console.log(b), k = b.toString()), this.setData({
            phoneText: e,
            teamText: k,
            scheduleText: W,
            priceText: W
        });
    },
    onLoad: function(t) {
        this.loadData(), e.addNotification("didChangePrivacy", this.loadData, this);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {
        e.removeNotification("didChangePrivacy", this);
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            title: t.globalData.commonShareTitle,
            path: t.globalData.commonSharePath,
            imageUrl: t.globalData.commonShareImage,
            success: function(e) {},
            fail: function(e) {}
        };
    }
});